@extends('layouts.master')
@push('stylesheets')
    <link href="{{ URL::asset('/static/web/css/plugins/sweetalert/sweetalert.css')}}?v=33" rel="stylesheet">
@endpush
@section('content')
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox">
                <div class="ibox-content">
                    <form class="layui-form" action="">
                        <div class="layui-inline">
                            <label class="layui-form-label">院校名称:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="query[name]" lay-verify="" placeholder="院校名称"
                                       value="{{$query['name']}}" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-inline" style="padding-bottom: 5px">
                            <div class="layui-input-inline">
                                <input type="hidden" name="page_num" value="{{$currentPageNum}}">
                                <button name="submit" class="btn btn-success" type="submit">搜索</button>
                            </div>
                        </div>
                    </form>
                    @section('toolbar')
                        <span class="left">
                            <a class="btn btn-primary" href="{{route('school.create')}}"><i class="fa fa-plus"></i>&nbsp;添加院校</a>
                        </span>
                    @endsection
                    @include('common.toolbar', ['pager' => $pager])
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>院校ID</th>
                            <th>院校名称</th>
                            <th>院校地址</th>
                            <th>联系人</th>
                            <th>联系方式</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($pager as $item)
                            <tr>
                            <td>{{$item->id}}</td>
                            <td>{{$item->name}}</td>
                            <td>{{$item->address}}</td>
                            <td>{{$item->person_in_charge}}</td>
                            <td>{{$item->contact_phone}}</td>
                            <td>{{$item->status==1?'开启':'关闭'}}</td>
                            <td> <a class="btn btn-outline btn-success"
                                    href="{{route('school.edit',[$item->id])}}">编辑</a></td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    @include('common.pagination', ['pager' => $pager])
                </div>
            </div>
        </div>
    </div>
@endsection



@section('script')
    <script>
        layui.use(['laydate', 'element'], function () {
            var laydate = layui.laydate, element = layui.element;
            //日期时间选择器
            laydate.render({
                elem: '.start_time'
                , type: 'datetime'
            });
            laydate.render({
                elem: '.end_time'
                , type: 'datetime'
            });
        });
    </script>
@endsection